package org.ndx.jsg.guice;

import java.io.File;
import java.util.Arrays;

/**
 * Loads all modules from all jars in a given directory
 * @author ndx
 *
 */
public class DirectoryModulesDiscoveryManager extends
		ClassPathModulesDiscoveryManager {
	/**
	 * Constructor
	 * @param includeSubDirs true to load all jars from all subdirs of given directories
	 * @param directories list of directories to scan
	 */
	public DirectoryModulesDiscoveryManager(boolean includeSubDirs,
			File... directories) {
		this(Thread.currentThread().getContextClassLoader(), includeSubDirs,
				directories);
	}

	/**
	 * 
	 * @param parent
	 * @param includeSubDirs
	 * @param directories
	 */
	public DirectoryModulesDiscoveryManager(ClassLoader parent,
			boolean includeSubDirs, File... directories) {
		super(ClassLoaderHelper.buildClassLoader(Arrays.asList(directories),
				includeSubDirs, parent));
	}
}